# -*- coding: utf-8 -*-
import logging
import os
# from baseData import *

logging.basicConfig(level=logging.DEBUG,
                    format="%(asctime)s [%(filename)s:%(lineno)s] %(message)s",
                    datefmt='%Y-%m-%d  %H:%M:%S %a',
                    filemode="w",force=True)






def GetLog(filename, level=logging.DEBUG):
    formatter = logging.Formatter('%(asctime)s [%(filename)s:%(lineno)s] %(message)s')


    logger = logging.getLogger(filename)
    file_path=r"log\%s" % (filename)
    file_handler = logging.FileHandler(file_path,mode="w",encoding="utf-8")
    file_handler.setLevel(level)

    file_handler.setFormatter(formatter)
    file_handler.encoding = "utf-8"

    logger.addHandler(file_handler)

    return logger


# def GetAbsPath(basedir, path):
#     return os.path.join(basedir, path)
